package com.stx.blog.action;

import java.util.ArrayList;
import java.util.List;

import com.opensymphony.xwork2.ActionSupport;
import com.stx.blog.service.BlogService;
import com.stx.blog.vo.BlogVo;
import com.sun.org.apache.bcel.internal.generic.NEW;

public class BlogAction extends ActionSupport {

	private BlogService service;

	private List<BlogVo> blogList = new ArrayList<BlogVo>();

	private BlogVo criteria = null;
	private BlogVo blog = null;
	private Integer bid = null;

	public String list() {
		 blogList = service.list(new BlogVo());
		return "list";
	}

	public String del() {
		service.delBlog(bid);
		return "list";
	}
	
	public String add(){
		service.addBlog(blog);
		return "list";
	}
	
	public String BlogListByBid(){
		blog=service.BlogListByBid(bid);
		return "update";
	}
	
	public String update(){
		service.updateBlog(blog);
		return "list";
	}

	public BlogService getService() {
		return service;
	}

	public void setService(BlogService service) {
		this.service = service;
	}

	public List<BlogVo> getBlogList() {
		return blogList;
	}

	public void setBlogList(List<BlogVo> blogList) {
		this.blogList = blogList;
	}

	public BlogVo getCriteria() {
		return criteria;
	}

	public void setCriteria(BlogVo criteria) {
		this.criteria = criteria;
	}

	public BlogVo getBlog() {
		return blog;
	}

	public void setBlog(BlogVo blog) {
		this.blog = blog;
	}

	public int getBid() {
		return bid;
	}

	public void setBid(int bid) {
		this.bid = bid;
	}
}
